# Contributor: Siva Mahadevan <me@svmhdvn.name>
# Maintainer: Siva Mahadevan <me@svmhdvn.name>
pkgname=kak-lsp
pkgver=12.2.1
pkgrel=0
pkgdesc="Language Server Protocol client for Kakoune implemented in Rust"
url="https://github.com/kak-lsp/kak-lsp"
arch="all !s390x !riscv64" # limited by cargo
license="Unlicense OR MIT"
makedepends="cargo"
source="$pkgname-$pkgver.tar.gz::https://github.com/kak-lsp/kak-lsp/archive/v$pkgver.tar.gz"

# Reduce binary size
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"
export CARGO_PROFILE_RELEASE_PANIC="abort"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 "target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"
}

sha512sums="
5135a3d7aa3bcd75590ece9dcf14c949262bf5e1643eece06ea7e1dde2717cd2732d05681418c51e3651aead5e4aac472f95c0759aeaac83c64c99d167889029  kak-lsp-12.2.1.tar.gz
"
